﻿
@{
    ViewBag.Title = "Caja";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript">

    $(document).ready(function () {

        $('#cajero').change(function () {
          
            var cajero = this.value;
            var turno = $('#turno').val();

            var params = "?cajero=" + cajero + "&turno=" + turno;

            $.post('ObtenerMovimientos' + params, function (data) {

                document.getElementById('divMovCaja').innerHTML = data;
            });

        });

        $('#turno').change(function () {

            var turno = this.value;
            var cajero = $('#cajero').val();

            var params = "?cajero=" + cajero + "&turno=" + turno;

            $.post('ObtenerMovimientos' + params, function (data) {

                document.getElementById('divMovCaja').innerHTML = data;
            });

        });      

    });

    function imprimirMovimientos() {
        var turno = $('#turno').val();
        var cajero = $('#cajero').val();

        var params = "?cajero=" + cajero + "&turno=" + turno;      

        var url = 'ImprimirMovimientosCaja' + params;
        window.open(url, '_blank');
    }

</script>

<h1>Resumen Caja</h1>

<table>
<tr>
<td>   
<label for="cajero">Cajero:</label>
@Html.DropDownList("cajero", (SelectList)ViewBag.Cajeros, "--Select cajero--")</td>
<td>
<label for="turno">Turno:</label>
@Html.DropDownList("turno", (SelectList)ViewBag.Turnos, "--Select turno--")</td>

</tr>
<tr>
<td colspan="2">
<div id="divMovCaja">

       @Html.Partial("TablaMovCaja")
</div>
                   
</td>
</tr>
<tr>
<td>
<a href="javascript:imprimirMovimientos();" target ="_blank" id="imprimirMov">Imprimir</a>
</td>
</tr>
</table>

